﻿<html>
<head><title>表单验证</title>
<script src="angular.min.js"></script>

</head>
<body>
   
     <form ng-app="myApp" ng-controller="mc" name="mf">
         name:<input type="text" name="user" ng-model="user" required>
         <span ng-show="mf.user.$dirty && mf.user.$invalid">
              <span ng-show="mf.user.$error.required">用户名是必须的</span>
         </span><br><br>
         
         email:<input type="email" name="email" ng-model="email" required>
         <span ng-show="mf.email.$dirty && mf.email.$invalid">
              <span ng-show="mf.email.$error.required">邮箱是必须的</span>
              <span ng-show="mf.email.$error.email">邮箱非法</span>
         </span><br><br>

        <input type="submit" ng-disabled="mf.user.$dirty && mf.uer.$invalid || mf.emeil.$dirty && mf.emeil.$invalid">
      
     </from>

<script>
   var app = angular.module("myApp",[]);
   app.controller("mc",function($scope){
      $scope.user= "Json";
      $scope.email= "213@163.com";
   });
</script>


</body>

</html>